Inside Macintosh: QuickTime Components

Previous | Chapter Top | Chapter Contents

Summary of Image Compressor Components

C Summary

Constants

#define compressorComponentType                 'imco'   /* compressor component type */
#define decompressorComponentType               'imdc'  /* decompressor component type */
/* selector values */
#define codecGetCodecInfo                       0x00    /* CDGetCodecInfo */
#define codecGetCompressionTime                 0x01    /* CDGetCompressionTime */
#define codecGetMaxCompressionSize              0x02    /* CDGetMaxCompressionSize */
#define codecPreCompress                        0x03    /* CDPreCompress */
#define codecBandCompress                       0x04    /* CDBandCompress */
#define codecPreDecompress                      0x05    /* CDPreDecompress */
#define codecBandDecompress                     0x06    /* CDBandDecompress */
#define codecCDSequenceBusy                     0x07    /* CDSequenceBusy */
#define codecGetCompressedImageSize             0x08    /* CDGetCompressedImageSize */
#define codecGetSimilarity                      0x09    /* CDGetSimilarity */
#define codecTrimImage                          0x0A    /* CDTrimImage */
/* image compressor component capabilities flags */
#define codecCanScale                       (1L<<0)     /* decompressor scales
                                                            information */
#define codecCanMask                        (1L<<1)     /* decompressor applies mask to
                                                            image */
#define codecCanMatte                       (1L<<2)     /* decompressor blends image using
                                                            matte */
#define codecCanTransform                   (1L<<3)     /* decompressor works with complex
                                                            placement matrices */
#define codecCanTransferMode                (1L<<4)     /* decompressor accepts transfer
                                                            mode */
#define codecCanCopyPrev                    (1L<<5)     /* compressor updates previous
                                                            image buffer */
#define codecCanSpool                       (1L<<6)     /* component can use functions to
                                                            spool data */
#define codecCanClipVertical                (1L<<7)     /* decompressor clips image
                                                            vertically */
#define codecCanClipRectangular             (1L<<8)     /* decompressor clips image
                                                            vertically & horizontally */
#define codecCanRemapColor                  (1L<<9)     /* compressor remaps color */
#define codecCanFastDither                  (1L<<10)    /* compressor supports fast
                                                            dithering */
#define codecCanSrcExtract                  (1L<<11)    /* compressor extracts portion
                                                            of source image */
#define codecCanCopyPrevComp                (1L<<12)    /* compressor updates previous
                                                            image buffer */
#define codecCanAsync                       (1L<<13)    /* component can work
                                                            asynchronously */
#definecodecCanMakeMask                     (1L<<14)    /* decompressor makes
                                                            modification masks */
#define codecCanShift                       (1L<<15)    /* component works with pixels
                                                            that are not byte-aligned */
/* compressor component condition flags passed to component in
    CDBandDecompress and CDPreDecompress functions indicate changes */
#define codecConditionFirstBand                     (1L<<0)     /* (input) first band
                                                                    in frame */
#define codecConditionLastBand                      (1L<<1)     /* (input) last band
                                                                    in frame */
#define codecConditionFirstFrame                    (1L<<2)     /* (input) first frame to be
                                                                     decompressed in this
                                                                     sequence */
#define codecConditionNewDepth                      (1L<<3)     /* (input) depth of
                                                                     destination */
#define codecConditionNewTransform                  (1L<<4)     /* (input) transformation
                                                                     matrix has changed */
#define codecConditionNewSrcRect                    (1L<<5)     /* (input) source rectangle */
#define codecConditionNewMask                       (1L<<6)     /* (input) mask bitmap has
                                                                     changed */
#define codecConditionNewMatte                      (1L<<7)     /* (input) matte pixel map */
#define codecConditionNewTransferMode               (1L<<8)     /* (input) transfer mode */
#define codecConditionNewClut                       (1L<<9)     /* (input) color lookup
                                                                     table */
#define codecConditionNewAccuracy                   (1L<<10)    /* accuracy parameter has
                                                                    changed */
#define codecConditionNewDestination                (1L<<11)    /*(input) destination pixel
                                                                    map */
#define codecConditionCodecChangedMask              (1L<<31)    /* (output) component has
                                                                    changed mask bits */
/* compressor and decompressor flag bits */
#define codecInfoDoes1                      (1L<<0)     /* works with 1-bit pixel maps */
#define codecInfoDoes2                      (1L<<1)     /* works with 2-bit pixel maps */
#define codecInfoDoes4                      (1L<<2)     /* works with 4-bit pixel maps */
#define codecInfoDoes8                      (1L<<3)     /* works with 8-bit pixel maps */
#define codecInfoDoes16                     (1L<<4)     /* works with 16-bit pixel maps */
#define codecInfoDoes32                     (1L<<5)     /* works with 32-bit pixel maps */
#define codecInfoDoesDither                 (1L<<6)     /* supports fast dithering */
#define codecInfoDoesStretch                (1L<<7)     /* stretches to arbitrary sizes */
#define codecInfoDoesShrink                 (1L<<8)     /* shrinks to arbitrary sizes */#define codecInfoDoesMask
(1L<<9)     /* handles clipping regions */
#define codecInfoDoesTemporal               (1L<<10)    /* sequential temporal
                                                            compression */
#define codecInfoDoesDouble                 (1L<<11)    /* stretches to double size
                                                            exactly */
#define codecInfoDoesQuad                   (1L<<12)    /* stretches to quadruple size */
#define codecInfoDoesHalf                   (1L<<13)    /* shrinks to half size */
#define codecInfoDoesQuarter                (1L<<14)    /* shrinks to one quarter size */
#define codecInfoDoesRotate                 (1L<<15)    /* rotates during decompression */
#define codecInfoDoesHorizFlip              (1L<<16)    /* flips horizontally during
                                                            decompression */
#define codecInfoDoesVertFlip               (1L<<17)    /* flips vertically during
                                                            decompression */
#define codecInfoDoesSkew                   (1L<<18)    /* skews image during
                                                            decompression */
#define codecInfoDoesBlend                  (1L<<19)    /* blends image with matte during
                                                            decompression */
#define codecInfoDoesWarp                   (1L<<20)    /* warps image arbitrarily during
                                                            decompression */
#define codecInfoDoesRecompress             (1L<<21) /* recompresses images without
                                                            accumulating errors */
#define codecInfoDoesSpool                  (1L<<22) /*     uses data-loading or
                                                            data-unloading function */
#define codecInfoDoesRateConstrain
                                            (1L<<23)    /* constrains amount of generated
                                                            data to caller-defined limit */
/* compressor and decompressor format flag bits */
#define codecInfoDepth1 (1L<<0)             /* compressed images with 1-bit
                                                color depth available */
#define codecInfoDepth2 (1L<<1)             /* compressed images with 2-bit
                                                color depth available */
#define codecInfoDepth4 (1L<<2)             /* compressed images with 4-bit
                                                color depth available */
#define codecInfoDepth8 (1L<<3)             /* compressed images with 8-bit
                                                color depth available */
#define codecInfoDepth16(1L<<4)             /* compressed images with 16-bit
                                                color depth available */
#define codecInfoDepth32(1L<<5)             /* compressed images with 32-bit
                                                color depth available */
#define codecInfoDepth24(1L<<6)             /* compressed images with 24-bit
                                                color depth available */
#define codecInfoDepth33(1L<<7)             /* compressed data with monochrome images of
                                                1-bit color depth */
#define codecInfoDepth34(1L<<8)             /* compressed images with
                                                2-bit grayscale depth available */
#define codecInfoDepth36(1L<<9)             /* compressed images with 4-bit grayscale
                                                depth available */
#define codecInfoDepth40(1L<<10)         /* compressed images with 8-bit grayscale
                                                depth available */
#define codecInfoStoresClut
                                (1L<<11)    /* compressed data with custom color
                                                tables */
#define     codecInfoDoesLossless
                                (1L<<12)    /* compressed data stored lossless format */
#define     codecInfoSequenceSensitive
                                (1L<<13) /* compressed data requires non-key frames
                                                to be compressed in same order as
                                                compressed */

Data Types

typedef struct {
    long                flags;                  /* control information */
    short               wantedPixelSize;        /* pixel depth for component to use
                                                    with image */
    short               extendWidth;            /* extension width of image in pixels */
    short               extendHeight;           /* extension height of image in pixels */
    short               bandMin;                /* supported minimum image band height */
    short               bandInc;                /* common factor of supported band
                                                    heights */
    short               pad;                    /* reserved */
    unsigned long       time;                   /* milliseconds operation takes to
                                                    complete */
} CodecCapabilities;
typedef CodecCapabilities *CodecCapabilitiesPtr;
typedef struct {
    ImageSequence                   sequenceID;                 /* sequence identifier ID
                                                                    (precompress or
                                                                    bandcompress) */
    ImageDescriptionHandle          imageDescription;           /* handle to image
                                                                    description structure
                                                                    (precompress or
                                                                     bandcompress) */
    Ptr                             data;                       /* location for receipt of
                                                                    compressed image data */
    long                            bufferSize;                 /* size of buffer for data */
    long                            frameNumber;                /* frame identifier */
    long                            startLine;                  /* starting line for band */
    long                            stopLine;                   /* ending line for band */
    long                            conditionFlags;             /* condition flags */
    CodecFlags                      callerFlags;                /* control info flags */
    CodecCapabilities               *capabilities;              /* pointer to compressor
                                                                    capability structure */
    ProgressProcRecord              progressProcRecord;         /* progress function
                                                                    structure */
    CompletionProcRecord            completionProcRecord;       /* completion function
                                                                    structure */
    FlushProcRecord                 flushProcRecord;            /* data-unloading function
                                                                    structure */
    PixMap                          srcPixMap;                  /* pointer to image
                                                                    (precompress or
                                                                     bandcompress) */
    PixMap                          prevPixMap;                 /*  pointer to pixel map
                                                                    for previous image */
    CodecQ                          spatialQuality;             /*  compressed image
                                                                    quality */
    CodecQ                          temporalQuality;            /* sequence temporal
                                                                    quality */
    Fixed                           similarity;                 /* similarity between
                                                                    adjacent frames */
    DataRateParamsPtr               dataRateParams;             /* pointer to the data rate
                                                                    parameters structure */
    long                            reserved;                   /* reserved */
} CodecCompressParams;
typedef CodecCompressParams *CodecCompressParamsPtr;
typedef struct {
    ImageSequence                   sequenceID;                 /* unique sequence ID
                                                                    (predecompress,
                                                                    band decompress) */
    ImageDescriptionHandle          imageDescription;           /* handle to image
                                                                    description structure
                                                                    (predecompress,
                                                                    band decompress) */
    Ptr                             data;                       /* compressed image data */
    long                            bufferSize;                 /* size of data buffer */
    long                            frameNumber;                /* frame identifier */
    long                            startLine;                  /* starting line for band */
    long                            stopLine;                   /* ending line for band */
    long                            conditionFlags;             /* condition flags */
    CodecFlags                      callerFlags;                /* control flags */
    CodecCapabilities               *capabilities;              /* pointer to compressor
                                                                    capability structure
                                                                    (predecompress,
                                                                    band decompress) */
    ProgressProcRecord              progressProcRecord;         /* progress function
                                                                    structure */
    CompletionProcRecord            completionProcRecord;/* completion function
                                                                    structure */
    DataProcRecord                  dataProcRecord;             /* data-loading function
                                                                    structure */
    CGrafPtr                        port;                       /* pointer to color
                                                                    graphics port for image
                                                                    (predecompress,
                                                                    band decompress) */
    PixMap                          dstPixMap;                  /* destination pixel map
                                                                    (predecompress,
                                                                     band decompress) */
    BitMapPtr                       maskBits;                   /* update mask */
    PixMapPtr                       mattePixMap;                /* blend matte pixel map */
    Rect                            srcRect;                    /* source rectangle
                                                                    (predecompress,
                                                                     band decompress) */
    MatrixRecord                    *matrix;                    /* pointer to matrix
                                                                    structure
                                                                    (predecompress,
                                                                     band decompress) */
    CodecQ                          accuracy;                   /* desired accuracy
                                                                    (predecompress,
                                                                     band decompress) */
    short                           transferMode;               /* transfer mode
                                                                    (predecompress,
                                                                     band decompress) */
    long                            reserved[2];                /* reserved */
} CodecDecompressParams;

typedef CodecDecompressParams *CodecDecompressParamsPtr;
/* progress function structure */
typedef struct ProgressProcRecord ProgressProcRecord;                   
typedef ProgressProcRecord *ProgressProcRecordPtr;
struct ProgressProcRecord {
        ProgressProcPtr progressProc;           /* pointer to your progress function */
        long progressRefCon;                    /* reference constant for use by
                                                    your progress function */
};

/* completion function structure */
typedef struct CompletionProcRecord CompletionProcRecord;
typedef CompletionProcRecord *CompletionProcRecordPtr;

struct CompletionProcRecord {
        CompletionProcPtr completionProc;           /* pointer to completion function */
        long completionRefCon;                      /* reference constant used by
                                                        completion function */
};

/* data-loading structure */
typedef struct DataProcRecord DataProcRecord;
typedef DataProcRecord *DataProcRecordPtr;

struct DataProcRecord {
        DataProcPtr dataProc;                       /* pointer to data-loading function */
        long dataRefCon;                            /* reference constant used by
                                                        data-loading function */
};

/* data-unloading structure */
typedef struct FlushProcRecord FlushProcRecord;
typedef FlushProcRecord *FlushProcRecordPtr;
struct FlushProcRecord {
        FlushProcPtr flushProc;         /* pointer to data-unloading function */
        long flushRefCon;               /* reference constant used by data-unloading
                                            function */
};

Functions

Direct Functions

pascal ComponentResult CDGetCodecInfo
(CodecInfo *info);
pascal ComponentResult CDGetMaxCompressionSize
(PixMapHandle src, const Rect *srcRect, short depth, CodecQ quality, long *size);
pascal ComponentResult CDGetCompressionTime
(PixMapHandle src, const Rect *srcRect, short depth, CodecQ *spatialQuality, CodecQ *temporalQuality, unsigned long *time);
pascal ComponentResult CDGetSimilarity
(PixMapHandle src, const Rect *srcRect, ImageDescriptionHandle desc, Ptr data, Fixed *similarity);
pascal ComponentResult CDGetCompressedImageSize
(ImageDescriptionHandle desc, Ptr data, long bufferSize, DataProcRecordPtr dataProc, long *dataSize);
pascal ComponentResult CDTrimImage
(ImageDescriptionHandle desc, Ptr inData, long inBufferSize, DataProcRecordPtr dataProc, Ptr outData, long outBufferSize, FlushProcRecordPtr flushProc, Rect *trimRect, ProgressProcRecordPtr progressProc);
pascal ComponentResult CDCodecBusy
(ImageSequence seq);

Indirect Functions

pascal ComponentResult CDPreCompress
(CodecCompressParams *params);
pascal ComponentResult CDBandCompress
(CodecCompressParams *params);
pascal ComponentResult CDPreDecompress
(CodecDecompressParams *params);
pascal ComponentResult CDBandDecompress
(CodecDecompressParams *params);

Image Compression Manager Utility Functions

pascal OSErr SetImageDescriptionExtension
(ImageDescriptionHandle desc, Handle extension, long idType);
pascal OSErr GetImageDescriptionExtension
(ImageDescriptionHandle desc, Handle *extension, long idType, long index);
pascal OSErr RemoveImageDescriptionExtension
(ImageDescriptionHandle desc, long type, long index);
pascal OSErr CountImageDescriptionExtensionType
(ImageDescriptionHandle desc, long type, long *count);
pascal OSErr GetNextImageDescriptionExtensionType
(ImageDescriptionHandle desc, long *type);

Pascal Summary

Constants

CONST
compressorComponentType                 ='imco'; {compressor component type}
decompressorComponentType               ='imdc'; {decompressor component type}

    {selector values}
    codecGetCodecInfo                   = $00;      {CDGetCodecInfo}
    codecGetCompressionTime             = $01;      {CDGetCompressionTime}
    codecGetMaxCompressionSize          = $02;      {CDGetMaxCompressionSize}
    codecPreCompress                    = $03;      {CDPreCompress}
    codecBandCompress                   = $04;      {CDBandCompress}
    codecPreDecompress                  = $05;      {CDPreDeCompress}
    codecBandDecompress                 = $06;      {CDBandDeCompress}
    codecCDSequenceBusy                 = $07;      {CDSequenceBusy}
    codecGetCompressedImageSize         = $08;      {CDGetCompressedImageSize}
    codecGetSimilarity                  = $09;      {CDGetSimilarity}
    codecTrimImage                      = $0a;      {CDTrimImage}
    {image compressor component capabilities flags}
    codecCanScale                       = $1;       {decompressor scales information}
    codecCanMask                        = $2;       {decompressor applies mask to image}
    codecCanMatte                       = $4;       {decompressor blends using matte}
    codecCanTransform                   = $8;       {decompressor works with complex }
                                                    { placement matrices}
    codecCanTransferMode                = $10;      {decompressor accepts transfer mode}
    codecCanCopyPrev                    = $20;      {compressor updates previous buffer}
    codecCanSpool                       = $40;      {component uses functions to spool }
                                                    { data}
    codecCanClipVertical                = $80;      {decompressor clips vertically}
    codecCanClipRectangular             = $100;     {decompressor clips vertically }
                                                    { & horizontally}
    codecCanRemapColor                  = $200;     {compressor remaps color}
    codecCanFastDither                  = $400;     {compressor does fast dithering}
    codecCanSrcExtract                  = $800;     {compressor extracts portion of }
                                                    { source image}
    codecCanCopyPrevComp                = $1000;    {compressor updates previous buffer}
    codecCanAsync                       = $2000;    {component works asynchronously}
    codecCanMakeMask                    = $4000;    {decompressor makes masks}
    codecCanShift                       = $8000;    {component works with pixels }
                                                    { that are not byte-aligned}
    {condition flags}
    codecConditionFirstBand                     = $1;           {first band in frame}
    codecConditionLastBand                      = $2;           {last band in frame}
    codecConditionFirstFrame                    = $4;           {(input) first frame to be }
                                                                { decompressed in this }
                                                                { sequence}
    codecConditionNewDepth                      = $8;           {(input) depth of }
                                                                { destination}
    codecConditionNewTransform                  = $10;          {(input) transformation }
                                                                { matrix has changed}
    codecConditionNewSrcRect                    = $20;          {(input) source rectange}
    codecConditionNewMask                       = $40;          {(input) mask bitmap }
                                                                { has changed}
    codecConditionNewMatte                      = $80;          {(input) matte pixel map)
    codecConditionNewTransferMode               = $100;         {(input) transfer mode}
    codecConditionNewClut                       = $200;         {(input) color lookup table}
    codecConditionNewAccuracy                   = $400;         {accuracy parameter has }
                                                                { changed}
    codecConditionNewDestination                = $800;         {(input) destination pixel }
                                                                { map}
    codecConditionCodecChangedMask              = $80000000;{changed mask bits}
    {CodecInfo compressFlags and deCompressFlags bits}
    codecInfoDoes1                      = $1;       {works with 1-bit pixel maps}
    codecInfoDoes2                      = $2;       {works with 2-bit pixel maps}
    codecInfoDoes4                      = $4;       {works with 4-bit pixel maps}
    codecInfoDoes8                      = $8;       {works with 8-bit pixel maps}
    codecInfoDoes16                     = $10;      {works with 16-bit pixel maps}
    codecInfoDoes32                     = $20;      {works with 32-bit pixel maps}
    codecInfoDoesDither                 = $40;      {supports fast dithering}
    codecInfoDoesStretch                = $80;      {stretches to arbitrary sizes}
    codecInfoDoesShrink                 = $100;     {shrinks to arbitrary sizes}
    codecInfoDoesMask                   = $200;     {handles clipping regions}
    codecInfoDoesTemporal               = $400;     {sequential temporal }
                                                    { compression}
    codecInfoDoesDouble                 = $800;     {stretches to double size}
    codecInfoDoesQuad                   = $1000;    {stretches to quadruple size}
    codecInfoDoesHalf                   = $2000;    {shrinks to half size}
    codecInfoDoesQuarter                = $4000;    {shrinks to one-quarter size}
    codecInfoDoesRotate                 = $8000;    {rotates during decompression}
    codecInfoDoesHorizFlip              = $10000;{flips horizontally}
    codecInfoDoesVertFlip               = $20000;   {flips vertically}
    codecInfoDoesSkew                   = $40000;   {skews image during }
                                                    { decompression}
    codecInfoDoesBlend                  = $80000;   {blends image with matte }
                                                    { during decompression}
    codecInfoDoesWarp                   = $100000;  {warps image during }
                                                    { decompression}
    codecInfoDoesRecompress             = $200000;  {recompresses images}
    codecInfoDoesSpool                  = $400000;  {uses data-loading }
                                                    { or unloading functions}
    codecInfoDoesRateConstrain          = $800000;{constrains amount of generated }
                                                    { data to caller-defined limit}
    {codecInfo formatFlags bits}
    codecInfoDepth1                     = $1;       {color images with 1-bit color depth}
    codecInfoDepth2                     = $2;       {color images with 2-bit color depth}
    codecInfoDepth4                     = $4;       {color images with 4-bit color depth}
    codecInfoDepth8                     = $8;       {color images with 8-bit color depth}
    codecInfoDepth16                    = $10;      {color images with 16-bit color depth}
    codecInfoDepth32                    = $20;      {color images with 32-bit color depth}
    codecInfoDepth24                    = $40;      {color images with 24-bit color depth}
    codecInfoDepth33                    = $80;      {monochrome images with 1-bit color }
                                                    { depth}
    codecInfoDepth34                    = $100;     {grayscale images with 2-bit }
                                                    { grayscale depth}
    codecInfoDepth36                    = $200;     {grayscale images with 4-bit }
                                                    { grayscale depth}
    codecInfoDepth40                    = $400;     {grayscale images with 8-bit }
                                                    { grayscale depth}
    codecInfoStoresClut                 = $800;     {custom color tables}
    codecInfoDoesLossless               = $1000;    {lossless compression or }
                                                    { decompression operations}
    codecInfoSequenceSensitive = $2000; {compression data requires non-key }
                                                    { frames to be decompressed in same }
                                                    { order as compressed}

Data Types

TYPE    CodecCapabilities =
        RECORD
            flags:                  LongInt;        {control information}
            wantedPixelSize:        Integer;        {pixel depth for component to use }
                                                    { with image}
            extendWidth:            Integer;        {extension width of image}
            extendHeight:           Integer;        {extension height of image}
            bandMin:                Integer;        {supported minimum band height}
            bandInc:                Integer;        {common factor of band heights}
            pad:                    Integer;        {reserved}
            time:                   Integer;        {milliseconds to completion}
        END;
        
        CodecCapabilitiesPtr                        =^CodecCapabilities;
        CodecCompressParams =
        RECORD
            sequenceID:                 ImageSequence;      {sequence identifier ID}
            imageDescription:           ImageDescriptionHandle;
                                                            {handle to image }
                                                            { description record}
            data:                       Ptr;                {location for receipt of }
                                                            { compressed image data}
            bufferSize  :               LongInt;            {size of buffer for data}
            frameNumber:                LongInt;            {frame identifier}
            startLine:                  LongInt;            {starting line for band}
            stopLine:                   LongInt;            {ending line for band}
            conditionFlags:             LongInt;            {condition flags}
            callerFlags:                CodecFlags;         {control information flags}

            capabilities:               CodecCapabilitiesPtr;
                                                            {pointer to compressor }
                                                            { capability record
            progressProcRecord:         ProgressProcRecord;
                                                            {progress function record}
            completionProcRecord:       CompletionProcRecord;
                                                            {completion function }
                                                            { record}
            flushProcRecord:            FlushProcRecord;
                                                            {data-unloading function }
                                                            { record}
            srcPixMap:                  PixMap;             {pointer to image}
            prevPixMap:                 PixMap;             {pointer to pixel map }
                                                            { for previous image}
            spatialQuality:             CodecQ;             {compressed image quality}
            temporalQuality:            CodecQ;             {sequence temporal quality}
            similarity:                 Fixed;              {similarity between }
                                                            { adjacent frames}
            dataRateParams              dataRateParamsPtr;
                                                            {pointer to the data rate }
                                                            { parameters record}
            reserved:                   ARRAY[0..1] OF LongInt;
                                                            {reserved}
    END;

    CodecCompressParamsPtr                      = ^CodecCompressParams;
    CodecDecompressParams =
    RECORD
        sequenceID:                     ImageSequence;      {unique sequence ID}
        imageDescription:               ImageDescriptionHandle;
                                                            {handle to image }  
                                                            { description record}
        data:                           Ptr;                {compressed image data}
        bufferSize:                     LongInt;            {size of data buffer}
        frameNumber:                    LongInt;            {frame identifier}
        startLine:                      LongInt;            {starting line for band}
        stopLine:                       LongInt;            {ending line for band}
        conditionFlags:                 LongInt;            {condition flags}
        callerFlags:                    CodecFlags;         {control flags}
        capabilities:                   CodecCapabilitiesPtr;
                                                            {pointer to compressor }
                                                            { capability record}

        progressProcRecord:             ProgressProcRecord;
                                                            {progress function record}
        completionProcRecord:           CompletionProcRecord;
                                                            {completion function record}
        dataProcRecord:                 DataProcRecord;{data-loading function }
                                                            { record}
        port:                           CGrafPtr;           {pointer to color }
                                                            { grafport for image}
        dstPixMap:                      PixMap;             {destination pixel map}
        maskBits:                       BitMapPtr;          {update mask}
        mattePixMap:                    PixMapPtr;          {blend matte pixel map}
        srcRect:                        Rect;               {source rectangle}
        matrix:                         MatrixRecordPtr;
                                                            {pointer to matrix }
                                                            { structure}
        accuracy:                       CodecQ;             {desired accuracy}
        transferMode:                   Integer;            {transfer mode}
        reserved:                       ARRAY[0..1] OF LongInt;
                                                            {reserved}
    END;
    CodecDecompressParamsPtr                    = ^CodecDecompressParams;

    ProgressProcRecordPtr                       = ^ProgressProcRecord;
    ProgressProcRecord      =
    RECORD
        progressProc:           ProgressProcPtr;        {pointer to progress function}
        progressRefCon:         LongInt;                {progress function }
                                                        { reference constant}
    END;
    
    CompletionProcRecordPtr                         = ^CompletionProcRecord;
    CompletionProcRecord        =
    RECORD
        completionProc:         CompletionProcPtr;{pointer to completion function}
        completionRefCon:       LongInt;                {completion function reference }
                                                        { constant}
    END;
    
    DataProcRecordPtr           = ^DataProcRecord;
    DataProcRecord =
    RECORD
        dataProc:           DataProcPtr;            {pointer to data-loading function}
        dataRefCon:         LongInt;                {data-loading function }
                                                    { reference constant}
        END;
    
    FlushProcRecordPtr          = ^FlushProcRecord;
    FlushProcRecord =
    RECORD
        flushProc:          FlushProcPtr;           {pointer to data-unloading function}
        flushRefCon:        LongInt;                {data-unloading function reference }
                                                    { constant}
    END;

Routines

Direct Functions

FUNCTION CDGetCodecInfo (VAR info: CodecInfo): ComponentResult;
FUNCTION CDGetMaxCompressionSize
(src: PixMapHandle; srcRect: Rect; depth: Integer; quality: CodecQ; VAR size: LongInt): ComponentResult;
FUNCTION CDGetCompressionTime
(src: PixMapHandle; srcRect: Rect; depth: Integer; VAR spatialQuality: CodecQ; VAR temporalQuality: CodecQ; VAR time: LongInt): ComponentResult;
FUNCTION CDGetSimilarity (src: PixMapHandle; srcRect: Rect; desc: ImageDescriptionHandle; data: Ptr; VAR similarity: Fixed): ComponentResult;
FUNCTION CDGetCompressedImageSize
(desc: ImageDescriptionHandle; data: Ptr; bufferSize: LongInt; dataProc: DataProcRecordPtr; VAR dataSize: LongInt): ComponentResult;
FUNCTION CDTrimImage (desc: ImageDescriptionHandle; inData: Ptr; inBufferSize: LongInt; dataProc: DataProcRecordPtr; outData: Ptr; outBufferSize: LongInt; flushProc: FlushProcRecordPtr; VAR trimRect: Rect; progressProc: ProgressProcRecordPtr): ComponentResult;
FUNCTION CDCodecBusy (seq: ImageSequence): ComponentResult;

Indirect Functions

FUNCTION CDPreCompress (params: CodecCompressParamsPtr): ComponentResult;
FUNCTION CDBandCompress (params: CodecCompressParamsPtr): ComponentResult;
FUNCTION CDPreDecompress (params: CodecCompressParamsPtr): ComponentResult;
FUNCTION CDBandDecompress (params: CodecCompressParamsPtr): ComponentResult;

Image Compression Manager Utility Functions

FUNCTION SetImageDescriptionExtension
(desc: ImageDescriptionHandle; extension: Handle; idType: LongInt): OSErr;
FUNCTION GetImageDescriptionExtension
(desc: ImageDescriptionHandle; VAR extension: Handle; idType: LongInt; index: LongInt): OSErr;
FUNCTION RemoveImageDescriptionExtension
(desc: ImageDescriptionHandle; idType: LongInt; index: LongInt): OSErr;
FUNCTION CountImageDescriptionExtensionType
(desc: ImageDescriptionHandle; idType: LongInt; VAR count: LongInt): OSErr;
FUNCTION GetNextImageDescriptionExtensionType
(desc: ImageDescriptionHandle; VAR idType: LongInt): OSErr;

Result Codes

codecErr

-8960

General error returned by compressor; can be returned by any function that gets handled by the compressor

noCodecErr

-8961

Image Compression Manager could not find specified error

codecUnimpErr

-8962

Feature not implemented by this compressor

codecSpoolErr

-8966

Error loading or unloading data

codecAbortErr

-8967

Operation aborted by progress function

codecExtensionNotFoundErr

-8971

Requested extension is not in the image description structure

codecOpenErr

-8973

Compressor component could not be opened by the Image Compression Manager


© 1997 Apple Computer, Inc.

Previous | Chapter Top | Chapter Contents